<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/" py:strip="">
<head py:strip=""/>
<body py:strip="">
<table py:strip="">
<tr id="titleRow">
  <td>
    <b id="actionTitle" py:content="action.title[:80]">Action Title</b>
  </td>
  <td>
    <b py:content="action.context.title">Context Title</b>
  </td>
  <td>
    <b py:content="action.context.title">Project Title</b>
  </td>
  <td>
    <b py:content="action.modified">Modified</b>
  </td>
  <td>
      <a py:if="action.closed" href="/action/open?id=${action.id}&amp;previousPage=${previousPage}">Re-open</a>
      <a py:if="not action.closed" href="/action/close?id=${action.id}&amp;previousPage=${previousPage}"><img src="/static/images/done.gif" title="done"/></a>
      <a href="#" onclick="toggle('action_note${action.id}'); "><img src="/static/images/view.gif" title="details"/></a>
      <a href="#" onclick="$('#action_widget${action.id}').SlideToggleUp(500);$('#action_widget${action.id}').ScrollTo(800)" ><img src="/static/images/edit.png" title="edit"/></a>
      <a py:if="action.priority &gt; 0" href="/action/rankUp?id=${action.id}&amp;previousPage=${previousPage}" ><img src="/static/images/rankUp.gif" title="rank Up"/></a>
      <a py:if="action.priority &lt; 4" href="/action/rankDown?id=${action.id}&amp;previousPage=${previousPage}"><img src="/static/images/rankDown.gif" title="rank Down"/></a>
      <a py:if="action.priority == 0"><img src="/static/images/star.gif" title="Next Action"/></a>
      <a py:if="action.priority &gt; 0"><img src="/static/images/greyStar.gif" title="Mark as next Action"/></a>
  </td>
</tr>
<tr>
  <td colspan="3">
    <div id="action_note${action.id}" style="display: none;">
      ${action._get_textilizedNotes()}
    </div>
  </td>
</tr>
<tr>
<td colspan="3">
  <div id="action_widget${action.id}" style="display: none;">
  <form action="/action/save" method="post">
    <fieldset>
      <legend>Edit</legend>
      <input type="hidden" id="previousPage" name="previousPage" value="${previousPage}" />
      <input type="hidden" id="id" name="id" value="${action.id}" />
      <p>
        <label for="title">Title</label>
        <input type="text" id="title" name="title" value="${action.title}"/>
      </p>

      <p>
        <label for="notes">Notes</label>
        <textarea id="notes" name="notes">${action.notes}</textarea>
      </p>

      <p>
        <label for="contextId">Context</label>
        <select id="contextId" name="contextId">
            <option py:for="context in tg.contexts" value="${context.id}" selected="${tg.selector(context == action.context)}">${context.title}</option>
        </select>
      </p>
      <p>
        <label for="priority">Priority (${action.priority})</label>
        <select id="priority" name="priority">
            <option py:for="priority in tg.priorities" value="${priority.value}" selected="${tg.selector(priority.value == action.priority)}">${priority.title}</option>
        </select>
      </p>
      <p>
        <label for="projectId">Project</label>
        <select id="projectId" name="projectId">
          <option py:for="project in tg.projects" value="${project.id}" selected="${tg.selector(project == action.project)}">${project.title}</option>
        </select>
      </p>
      <input type="submit" name="submit_updateAction" value="Update" />
      <!-- Without ScrollTo the screen is scrolled to top and the user doesn't see the confirm dialog. -->
      <input type="submit" id="delete_action${action.id}" onclick="toggle('confirm_delete_action${action.id}');$('#confirm_delete_action${action.id}').ScrollTo(0);return false;" value="Delete"/>
      <div id="confirm_delete_action${action.id}" class="confirm" style="display: none">
        <label>Are you sure you want to delete the action?</label>
        <a href="/action/delete?id=${action.id}">Yes</a>
        <a href="#" onclick="toggle('confirm_delete_action${action.id}');">No</a>
      </div>
   </fieldset>
  </form>
  </div>
</td>
  </tr>
  </table>
</body>
</html>
